
// NewPromiseResolveThenableJobTask测试

const MyPromise = require('./MyPromise')

async function async1() {
    console.log("async1 start");
    await async2();
    console.log("async1 end");
}
async function async2() {
    console.log("async2");
    return MyPromise.resolve().then(() => {
        console.log("async2-inner");
    });
}

console.log("script start");
setTimeout(function () {
    console.log("settimeout");
});

async1();
new MyPromise(function (resolve) {
    console.log("promise1");
    resolve();
})
    .then(function () {
        console.log("promise2");
    })
    .then(function () {
        console.log("promise3");
    })
    .then(function () {
        console.log("promise4");
    });
console.log("script end");


// script start
// async1 start
// async2
// promise1
// script end
// async2-inner
// promise2
// promise3
// async1 end
// promise4
// settimeout